<?php
session_start();
include_once("include.inc.php");
include_once("include.class.php");
CheckLogin();
/*

$time = microtime();

$hidPageNow = $_POST['hidPageNow'];
$recordCount = $_POST['hidRecordCount'];

if($_POST['hidC'] == ""){
	$c = "songID";
}
else{
	$c = $_POST['hidC'];
}
$o = $_POST['hidO'] == "desc" ? "asc" : "desc";

if(!is_numeric($recordCount)){
	$count = 'SELECT COUNT(*) as ct FROM tbl_song o,tbl_singer i,tbl_song_singer oi WHERE (o.songID = oi.songID AND oi.singerID = i.singerID) AND (LENGTH(i.singerName) > 8)';
	if($result = $conn -> Execute($count)){
		$arrRow = $result->FetchRow();
		$recordCount = $arrRow['ct'];
	}
}
$sql = 'SELECT o.songID,o.songName,o.songHits FROM tbl_song o,tbl_singer i,tbl_song_singer oi WHERE (o.songID = oi.songID AND oi.singerID = i.singerID) AND (LENGTH(i.singerName) > 8)';
if($o != ""){
	$sql .= " ORDER BY ".$c." ".$o;
}
$objPager = new Pager($recordCount,$sql,$hidPageNow,"fModifySongList",$_POST['hidO']);
if($result = $conn->Execute($objPager -> SetQuery())){
	$i = 0;
	while($arrRow = $result->FetchRow()){
		$sql = 'SELECT i.singerName,i.singerID FROM tbl_singer i,tbl_song_singer oi WHERE (oi.songID = "'.$arrRow['songID'].'" AND oi.singerID = i.singerID) AND (LENGTH(i.singerName) > 8)';
		$singerResult = $conn->Execute($sql);
		$singerArrRow = $singerResult->FetchRow();
		$arrSongList[$i] = $arrRow;
		$arrSongList[$i]['singerID'] = $singerArrRow['singerID'];
		$arrSongList[$i]['singerName'] = $singerArrRow['singerName'];
		$i++;
	}
}

$objSmarty -> assign("arrSongList",$arrSongList);
$objSmarty -> assign("hidPageNow",$hidPageNow);
$objSmarty -> assign("hidRecordCount",$recordCount);
$objSmarty -> assign("pager",$objPager->ShowMain().$objPager->ShowText_().$objPager->ShowGoTo());

$objSmarty -> assign("c",$c);
$objSmarty -> assign("o",$o);
*/
$objSmarty -> display("modifySongList.html");
?>